﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000116682788";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQClHeNPmyvdj7n1HzSmZnfoTGpaAExU7BgVWfQKm8kJKqTM4hMH5kmATwljYzh1JKKBSczdM7FWipEuMWJxmOC2UPOBEGKr+EhdRj3CS+X/cQ5JmkokdrtBrgtqqxtXH+o48dg98HY0DrNWRiK57kavjBOsWTUDGTb4UwjS7FfiLFGqsRIPa/UHGm0CTg4476G60tBPXVOhxhGzkx+qZZeuzEJyEOKwhGbZm6HX77pHgqTiVEf5tfrv1H7DLfwoKfJdafILufdJAgRDq4fSB1cpwcLsJhSDFlvmgOBp0BHGJV4d27QLV6emqpIYGb+poQNzCZWh3rlqME+DMC4b7E1LAgMBAAECggEBAI9ZSFx3afjb6+TcZ7hDY7yAgyCJ+7sKkcoPo2iGYV2c8SCS8VS9YHiNpafsnzpMSO0X5kzwsPhiKrLA2yemQwjldNJLKG8GicS406tYe2Buhanu0omfrujRskW0MXNNWOqBRGxZ1DVTweyXzVRAgourf/T0Kar7/BZQ+GsuFwpaazwln9Be5cYS1oUK2V/u19oX8Oheqh42udsaeZV926V70WPXCuorH7oYxRf+ytHRzUiYIGTQ/0oh2ptR4EsLR+FVCceOi/hmVIhHcTZ0PLTREvzyl84vqEtRxHbVw3JSwmJm0f+va6LLiNYTX/x3kS4MM+IaUUs+5iUpqnaRSDECgYEA4UzDF/bgPDe7AddO2ckduUIprmbkW+mIOqPOtSo5/Fv9YkQ1tNPts/cndUvaxYr4CXZsLOvt+7lAY5lNwZ4I+UZUYlJPuKd4hVLTRtNAWTyO4W9OFAZr03aanjMPxdzc/ey095nBr8TU9goUaWS2DEUgGGHGK3s8MaqIIkDsOhkCgYEAu527K5yBGAHyf/77hcEy6SWCS0KjGPKwXc8kN7+AVokmNpvdEMNsb8/IopbDi6Ia2yhbH3IJ5y55fA1OqstfFR5Qp86BrMjXlkfd8FlkcjwXbA8Oiiw/PTU7ZqbGcP6c/fPInLrdb0WMZc7JMZvxIsC7wOtapfGm/u5SWmwWdwMCgYAqwVuAr7wMEXNuvQJcuBro7lJko2gQvTe6ER4IKVRJvNdQD6u1fkZs0aluTA/fTykU+qE6wScvjw9WF2C3Lpt7WspmwkIYw8dOXdJ0bWCXzrM6utmxWSqbPbXH8d67aNeTZJlPJ6GnDo5vhqgq/A7EM1YM6nkmBUP+FOOyxGlP+QKBgEiAhcouqryKVBoegTiJFpF+i0FmOPz1HC7EU6yvdnr6eSf1R5Ko0ojK9S/PrzWQqWwzxjL6sNUD4rKLufDKsq3Ij0apyPbqjlVm5F9zTBvRGQQLNYUz4CRZI+FhZaJY4nZI9SeMFvJfIAhfxuRC7QaPEH9W9CrYnb46ftyulGfdAoGAIBHDB+18kLtDcbZWaaNKZlLqMkLATJkHow1e9yNQ4kRS1/92aXQYGEvQniAqb9E+lGwoXjon1T83as6VyHQtmBULIFQNZcdyLiPxJ3rc8R+lYQOciIFIfCRoUCvtJ8aJwPb3kNs/vOgUgiBPSRUsyxCxJcOg54w4ey2OZlzD0I8=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
//    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo5sdvtLbF4J1tYDlI0ByVUr/csf5XtaP+UwaEHgyTdI/lcet4L/boYOSe4WzPZ7fHHV7JMdztSBaSdVL9dfq1j1Z9Oug9L5L4q/3D0zy4Hc78AhOxPU0ydj0KlYXZ1+Nyqg2jSNQOAUb7cheYN1jQgiy8Vtm4qYaXpdou8l9kxdqbPxrON32wYUupg9HOgvaYAtzP90+aa9OZXI7OKNE6U2ItV1whpArqcwKz0vyQa5SBBtBRBzRsXxa0R09V2OMvY+4Q7/q9/oKExOWBYRelkqOPwd4oqQiUn07evQEiyUcJOXn+ut1YKbq6zTfVQ7x6643nZeV8s0UZJ9rsWm66wIDAQAB";
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo5sdvtLbF4J1tYDlI0ByVUr/csf5XtaP+UwaEHgyTdI/lcet4L/boYOSe4WzPZ7fHHV7JMdztSBaSdVL9dfq1j1Z9Oug9L5L4q/3D0zy4Hc78AhOxPU0ydj0KlYXZ1+Nyqg2jSNQOAUb7cheYN1jQgiy8Vtm4qYaXpdou8l9kxdqbPxrON32wYUupg9HOgvaYAtzP90+aa9OZXI7OKNE6U2ItV1whpArqcwKz0vyQa5SBBtBRBzRsXxa0R09V2OMvY+4Q7/q9/oKExOWBYRelkqOPwd4oqQiUn07evQEiyUcJOXn+ut1YKbq6zTfVQ7x6643nZeV8s0UZJ9rsWm66wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/wk1un2_electricity_digital/Front/alipay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/wk1un2_electricity_digital/index";
	// 签名方式
	public static String sign_type = "RSA2";	
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

